package com.zlc.workflow.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

@Getter
@AllArgsConstructor
public enum TaskStatusEnum {

    PROCESSING("processing","待处理"),
    COMPLETE("complete","已处理"),
    ;
    private String status;
    private String desc;

    public static TaskStatusEnum  getStatus(String status){
        TaskStatusEnum[] statusList = values();
        for(TaskStatusEnum statusEnum : statusList){
            if(statusEnum.status.equals(status)){
                return statusEnum;
            }
        }
        return null;
    }

    public static String getStatusName(String status){
        TaskStatusEnum statusEnum = getStatus(status);
        return Objects.nonNull(statusEnum)?statusEnum.getDesc():null;
    }
}
